import com.cl.pojo.User;
import com.cl.service.user.UserService;
import com.cl.utils.Upload;
import org.junit.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import java.io.IOException;

import java.io.File;

public class test {
    @Test
    public void test1() {
        System.out.println(123);
    }

    @Test
    public void test2() {

    }

    @Test
    public void test() {
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        UserService service = (UserService) context.getBean("userServiceImpl");
        User vv = service.userLogin("vv", "123");
        System.out.println(vv);
    }

    @Test
    public void ts1() {
        // 获取classpath路径下指定内容
        String path2 = null;
//            path2 = ClassLoader.getSystemResource("uploadImages").getPath().toString().substring(1);
//            path2 = ClassLoader.getSystemResource("uploadImages").getPath().toString().substring(1);
        path2 = this.getClass().getClassLoader().getResource("uploadImages").getPath().toString().substring(1);
        System.out.println(path2);
    }

    @Test
    public void ts2() {
        Upload upload = new Upload();
        try {
            System.out.println(upload.upload("E:\\Videos\\素材\\01.mp4", "01.mp4"));
        } catch (IOException e) {
            e.printStackTrace();
        }


    }
    @Test
    public void test3(){
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        Upload bean = context.getBean("upload", Upload.class);
        System.out.println(bean);
    }
}
